using System.Text.Json.Serialization;

namespace IMClient.Model
{
    public class ApiResponse
    {
        [JsonPropertyName("code")]
        public string Code { get; set; } = "";
        
        [JsonPropertyName("message")]
        public string Message { get; set; } = "";
        
        [JsonPropertyName("data")]
        public UserData? Data { get; set; }
    }

    public class UserData
    {
        public UserData(string userId)
        {
            UserId = userId;
        }

        [JsonPropertyName("userId")]
        public string UserId { get; set; } = "";
        [JsonPropertyName("userName")]
        public string UserName { get; set; } = "";

        [JsonPropertyName("avatar")]
        public string Avatar { get; set; } = "";
    }

    public class GroupApiResponse
    {
        [JsonPropertyName("code")]
        public string Code { get; set; } = "";
        
        [JsonPropertyName("message")]
        public string Message { get; set; } = "";
        
        [JsonPropertyName("data")]
        public Group? Data { get; set; }
    }

    public class Group
    {
        [JsonPropertyName("groupId")]
        public string GroupId { get; set; } = "";

        [JsonPropertyName("groupName")]
        public string GroupName { get; set; } = "";
        
        [JsonPropertyName("groupAvatar")]
        public string GroupAvatar { get; set; } = "";

        [JsonPropertyName("creator")]
        public string Creator { get; set; } = "";
    }
}
